﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<VCC.Site.ViewModels.SearchIndexModel>" %>
<%@ Import Namespace="VCC.Lib.Helpers" %>
<%@ Import Namespace="VCC.Lib.Common"%>
<%@ Import Namespace="VCC.Lib.Paging"%>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	<%=Model.Category.Name%> 
	<%if (Model.Suburbs != null && Model.Suburbs.Count() > 0)
   { %> Khu vực 
    <%foreach (var e in Model.Suburbs)
      { %>
      <%= e.Name%>, 
	<%}
   } %>   
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%Html.RenderAction("BoxQuickSearchAd","Ad",new{cateID = 0, keywords = string.Empty});%>
<div class="body-left" style="float:right">
	<div id="TopContent"></div>
	<div>
		<div class="SubTopContent" id="TopContentLeft"></div>
		<div class="SubTopContent" id="TopContentRight"></div>
	</div>
	<div style="clear: both;"></div>
	<div id="LeftMainContent">
		<div id="ctl29_BodyContainer">
			<div class="product-list product-list-page">
				<div class="Title">
					<h1>
						<%=Model.Category.Name%></h1>
					<div class="Footer">
						<strong>Tìm kiếm</strong>:<%= string.IsNullOrEmpty(Model.KeyWords) ? "" : "Từ khóa "+ "<span class=\"colorredbold\">\""+ Model.KeyWords+"\"</span>. "%>
						Trong danh mục: <span class="colorblue"><strong><a href="/<%=TextHelper.ToUrlFriendly(Model.Category.Name)%>"><%=Model.Category.Name%></a> </strong></span>.
						<%if (Model.Suburbs != null && Model.Suburbs.Count() > 0)
                        {%>
						    Khu vực/Suburb:
						        <%int c = 1; foreach (var subItem in Model.Suburbs)
                {%>
						     <%= c == 1? "" : "<font color=\"red\"> & </font>" %> <span class="greencolor"><strong><%=subItem.FullName%></strong></span>
						     <% c++;}%>
						<%}%>
						<%if (Model.FromDate != null && Model.FromDate.Year > 1973){%>
						.. Từ ngày: <%="<strong>"+ string.Format("{0:dd/MM/yyyy}",Model.FromDate)+"</strong>"%>
						<%} %>
						<%if (Model.ToDate != null && Model.ToDate.Year > 1973){%>
						Đến ngày: <%="<strong>"+ string.Format("{0:dd/MM/yyyy}",Model.ToDate)+"</strong>"%>
						<%} %>.. Có <span class="colorredbold"><%=Model.Ads.TotalItemCount%></span> tin.</div>
				</div>
				<div id="bannerQC">
					<div hasnotshare="True" hasshare="True" stylex="" positioncode="BANNER_POSITION_HORIZONTAL_MAIN_CONTENT" class="adPosition">
					</div>
				</div>
				<div class="Main">
					<div class="Header">
						<div class="Repeat">
							<h2> 
							    <%=Model.Category.Name%>
							    <%if (Model.Suburbs != null && Model.Suburbs.Count() > 0)
                                   { %> - Khu vực: <% int cs = 1; foreach (var e in Model.Suburbs)
                                      { %>
                                      <%= cs ==1 ? "":", "%><%=e.Name%> 
	                                <% cs++;
                                      }
                                   } %>
							</h2>
						</div>
					</div>
					<div class="clear"></div>
					<%if (Model.Ads != null && Model.Ads.Count() > 0)
                      {%>
                        <% foreach (var item in Model.Ads)
                           {
                               if (item.VIPTypeID == 1)
                               {%>
                                <div class="vip0">
                                    <div class="p-title">
                                        <h3>
                                            <a style="text-rendering: optimizeLegibility;" title="<%=item.Title %>" href="<%= LinkUtils.UrlAdDetails(item.Title,item.ID)%>"><%= Html.Encode(item.Title.Length > 110 ? TextHelper.CutString(item.Title, 110) + ".." : item.Title)%></a><%=Utils.CheckNewAdToDay(item.StartDate.Value)%>
                                        </h3>
                                    </div>
                                    <div class="p-main">
                                        <div class="p-main-image-crop">
                                            <a href="<%= LinkUtils.UrlAdDetails(item.Title,item.ID)%>" class="product-avatar">
                                                <img title="<%=item.Title %>" alt="<%=item.Title %>" src="<%=LinkUtils.UrlImageOrDefault(item.AvataImage)%>" class="product-avatar-img"> 
                                            </a>
                                        </div>
                                        <div class="p-content">
                                            <div style="text-rendering: optimizeLegibility;" class="p-main-text">
                                                <%=item.Content.Length > 200 ? TextHelper.CutAndRemoveHtml(item.Content,250) + ".." : TextHelper.RemoveHTML(item.Content)%>
                                            </div>
                                        </div>
                                        <div class="p-bottom-crop">
                                            <div class="floatleft">
                                                Giá: <span class="product-price"><%=string.Format("{0:#,#}",item.Cost)%> <%=item.CostType!= null ? item.CostType.Name : "$"%></span>&nbsp; Khu vực: <span class="product-city-dist"><%=item.Suburb.FullName %></span>
                                            </div>
                                            <div style="padding-right: 10px;" class="floatright"><%= VCC.Lib.Common.Utils.DateTimeToStringFormat(item.StartDate.Value)%></div>
                                            <div class="clear"></div>
                                        </div>
                                    </div>
                                    <div class="clear10"></div>
                                </div>
                                <%}
                               else if (item.VIPTypeID == 2)
                               {%>
                               <div class="vip1">
                                    <div class="p-title">
                                        <h3>
                                            <a style="text-rendering: optimizeLegibility;" title="<%=item.Title %>" href="<%= LinkUtils.UrlAdDetails(item.Title,item.ID)%>"><%= Html.Encode(item.Title.Length > 110 ? TextHelper.CutString(item.Title, 110) + ".." : item.Title)%></a><%=Utils.CheckNewAdToDay(item.StartDate.Value)%>
                                        </h3>
                                    </div>
                                    <div class="p-main">
                                        <div class="p-main-image-crop">
                                            <a href="<%= LinkUtils.UrlAdDetails(item.Title,item.ID)%>" class="product-avatar">
                                                <img title="<%=item.Title %>" alt="<%=item.Title %>" src="<%=LinkUtils.UrlImageOrDefault(item.AvataImage)%>" class="product-avatar-img"> 
                                            </a>
                                        </div>
                                        <div class="p-content">
                                            <div style="text-rendering: optimizeLegibility;" class="p-main-text">
                                                <%=item.Content.Length > 200 ? TextHelper.CutAndRemoveHtml(item.Content,250) + ".." : TextHelper.RemoveHTML(item.Content)%>
                                            </div>
                                        </div>
                                        <div class="p-bottom-crop">
                                            <div class="floatleft">
                                                Giá: <span class="product-price"><%=string.Format("{0:#,#}",item.Cost)%> <%=item.CostType!= null ? item.CostType.Name : "$"%></span>&nbsp; Khu vực: <span class="product-city-dist"><%=item.Suburb.FullName %></span>
                                            </div>
                                            <div style="padding-right: 10px;" class="floatright"><%= VCC.Lib.Common.Utils.DateTimeToStringFormat(item.StartDate.Value)%></div>
                                            <div class="clear"></div>
                                        </div>
                                    </div>
                                    <div class="clear10"></div>
                                </div>
                                <%}
                               else if (item.VIPTypeID == 3)
                               {%>
                               <div class="vip2">
                                    <div class="p-title">
                                        <h3>
                                            <a style="text-rendering: optimizeLegibility;" title="<%=item.Title %>" href="<%= LinkUtils.UrlAdDetails(item.Title,item.ID)%>"><%= Html.Encode(item.Title.Length > 110 ? TextHelper.CutString(item.Title, 110) + ".." : item.Title)%></a><%=Utils.CheckNewAdToDay(item.StartDate.Value)%>
                                        </h3>
                                    </div>
                                    <div class="p-main">
                                        <div class="p-main-image-crop">
                                            <a href="<%= LinkUtils.UrlAdDetails(item.Title,item.ID)%>" class="product-avatar">
                                                <img title="<%=item.Title %>" alt="<%=item.Title %>" src="<%=LinkUtils.UrlImageOrDefault(item.AvataImage)%>" class="product-avatar-img"> 
                                            </a>
                                        </div>
                                        <div class="p-content">
                                            <div style="text-rendering: optimizeLegibility;" class="p-main-text">
                                                <%=item.Content.Length > 200 ? TextHelper.CutAndRemoveHtml(item.Content,250) + ".." : TextHelper.RemoveHTML(item.Content)%>
                                            </div>
                                        </div>
                                        <div class="p-bottom-crop">
                                            <div class="floatleft">
                                                Giá: <span class="product-price"><%=string.Format("{0:#,#}",item.Cost)%> <%=item.CostType!= null ? item.CostType.Name : "$"%></span>&nbsp; Khu vực: <span class="product-city-dist"><%=item.Suburb.FullName %></span>
                                            </div>
                                            <div style="padding-right: 10px;" class="floatright"><%= VCC.Lib.Common.Utils.DateTimeToStringFormat(item.StartDate.Value)%></div>
                                            <div class="clear"></div>
                                        </div>
                                    </div>
                                    <div class="clear10"></div>
                                </div>
                                <%}
                               else if (item.VIPTypeID == 4)
                               {%>
                               <div class="vip3">
                                    <div class="p-title">
                                        <h3>
                                            <a style="text-rendering: optimizeLegibility;" title="<%=item.Title %>" href="<%= LinkUtils.UrlAdDetails(item.Title,item.ID)%>"><%= Html.Encode(item.Title.Length > 110 ? TextHelper.CutString(item.Title, 110) + ".." : item.Title)%></a><%=Utils.CheckNewAdToDay(item.StartDate.Value)%>
                                        </h3>
                                    </div>
                                    <div class="p-main">
                                        <div class="p-main-image-crop">
                                            <a href="<%= LinkUtils.UrlAdDetails(item.Title,item.ID)%>" class="product-avatar">
                                                <img title="<%=item.Title %>" alt="<%=item.Title %>" src="<%=LinkUtils.UrlImageOrDefault(item.AvataImage)%>" class="product-avatar-img"> 
                                            </a>
                                        </div>
                                        <div class="p-content">
                                            <div style="text-rendering: optimizeLegibility;" class="p-main-text">
                                                <%=item.Content.Length > 200 ? TextHelper.CutAndRemoveHtml(item.Content,250) + ".." : TextHelper.RemoveHTML(item.Content)%>
                                            </div>
                                        </div>
                                        <div class="p-bottom-crop">
                                            <div class="floatleft">
                                                Giá: <span class="product-price"><%=string.Format("{0:#,#}",item.Cost)%> <%=item.CostType!= null ? item.CostType.Name : "$"%></span>&nbsp; Khu vực: <span class="product-city-dist"><%=item.Suburb.FullName %></span>
                                            </div>
                                            <div style="padding-right: 10px;" class="floatright"><%= VCC.Lib.Common.Utils.DateTimeToStringFormat(item.StartDate.Value)%></div>
                                            <div class="clear"></div>
                                        </div>
                                    </div>
                                    <div class="clear10"></div>
                                </div>
                                <%}
                               else if (item.VIPTypeID == 5)
                               {%>
                                <div class="vip5">
                                    
                                    <div class="p-main">
                                        <div class="p-main-image-crop">
                                            <a href="<%= LinkUtils.UrlAdDetails(item.Title,item.ID)%>" class="product-avatar">
                                                <img title="<%=item.Title %>" alt="<%=item.Title %>" src="<%=LinkUtils.UrlImageOrDefault(item.AvataImage)%>" class="product-avatar-img"> 
                                            </a>
                                        </div>
                                        <div class="p-title">
                                            <h3>
                                                <a style="text-rendering: optimizeLegibility;" title="<%=item.Title %>" href="<%= LinkUtils.UrlAdDetails(item.Title,item.ID)%>"><%= Html.Encode(item.Title.Length > 110 ? TextHelper.CutString(item.Title, 110) + ".." : item.Title)%></a><%=Utils.CheckNewAdToDay(item.StartDate.Value)%>
                                            </h3>
                                        </div>
                                        <div class="p-content">
                                            <div style="text-rendering: optimizeLegibility;" class="p-main-text">
                                                <%=item.Content.Length > 200 ? TextHelper.CutAndRemoveHtml(item.Content,250) + ".." : TextHelper.RemoveHTML(item.Content)%>
                                            </div>
                                        </div>
                                        <div class="p-bottom-crop">
                                            <div class="floatleft">
                                                Giá: <span class="product-price"><%=string.Format("{0:#,#}",item.Cost)%> <%=item.CostType!= null ? item.CostType.Name : "$"%></span>&nbsp; Khu vực: <span class="product-city-dist"><%=item.Suburb.FullName %></span>
                                            </div>
                                            <div style="padding-right: 10px;" class="floatright"><%= VCC.Lib.Common.Utils.DateTimeToStringFormat(item.StartDate.Value)%></div>
                                            <div class="clear"></div>
                                        </div>
                                    </div>
                                    <div class="clear10"></div>
                                </div>
                            <%}
                           }
                      }
                      else
                      {%>
                        <div style="text-align:center; padding:20px 0px 20px 0px;">
                            Không có tin rao nào theo tiêu chí tìm kiếm này!
                        </div>
                      <%} %>
                      <div class="clear10"></div>
				</div>
			</div>	
			<div class="clear"></div>
			<div class="background-pager-controls">
				<div class="pager background-pager-right-controls">
				    <%=Html.Pager(Model.Ads.PageSize, Model.Ads.PageNumber, Model.Ads.TotalItemCount, "index", new { KeyWords = Model.KeyWords, FromDate = Model != null && Model.FromDate.Year > 2000 ? string.Format("{0:dd-MM-yyy}", Model.FromDate) : string.Empty, ToDate = Model != null && Model.ToDate.Year > 2000 ? string.Format("{0:dd-MM-yyyy}", Model.ToDate) : string.Empty })%>
				</div>
			</div>
		</div>
	</div>
</div>
    
<!--Start div body-right-->
<div id="RightMainContent" class="body-right" style="float:left;width: 250px;">
	<%Html.RenderAction("SearchFullbox", "Search", new { listSuburb = Model.Suburbs, currentCate = Model.Category, fromDate = Model.FromDate, toDate= Model.ToDate, keyWord = Model.KeyWords });%>
	
    <div class="clear"></div>
    <div style="clear: both; margin-bottom: 5px;"></div>
	<%Html.RenderAction("BoxCategoryLeft", "Ad", new { currentCateID = Model.Category.ID}); %>
	<div style="clear: both; margin-bottom: 5px;"></div>
	<div style="clear:both;"></div>
	<%--<div class="box1">
		<h1 class="h1">Thông tin hỗ trợ</h1>
		<ul>
			<li><a title="Bảng giá dự án" href="/trang-bang-gia-du-an">Bảng giá đăng tin VIP</a></li>
			<li><a title="Bảng giá đất 2013" href="/bang-gia-dat">Hướng dẫn đăng tin</a></li>
			<li class="last"><a title="" href="/van-ban-nganh-xay-dung">Liên hệ với hệ thống</a></li>
		</ul>
		<div class="clear"></div>
	</div>--%>
</div>
<!--End div body-right-->
<div class="clear"></div>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MetaTag" runat="server">
<% string mtTilte = Model.Category.Name;
   if (Model.Suburbs != null && Model.Suburbs.Count() > 1)
   {
       int c = 1;
       mtTilte = mtTilte + " khu vực ";
       foreach (var i in Model.Suburbs)
       {
           if (c == 1)
           {
               mtTilte = mtTilte + i.Name;
           }
           else {
               mtTilte = mtTilte + ", " + i.Name;
           }
           c++;
       }
   }
     %>
<meta name="title" content="<%=mtTilte%>"/>
<meta name="keywords" content="<%=mtTilte%>"/> 
<meta name="description" content="Tìm kiếm tin theo danh mục <%=mtTilte%>" />
<base href="<%= Html.Encode(Request.Url)%>"/>
</asp:Content>